package xyz.app.domain.accounts;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import xyz.app.DaoRegistry;
import xyz.app.Dao;
import xyz.app.Wrapper;
import xyz.app.dependencies.MemberAccessor;
import xyz.app.dependencies.HasDomainMembers;

import java.util.Collection;
import java.util.Set;

@Slf4j
@Service
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class DaoCorrespondent implements Dao<Correspondent>,
        HasDomainMembers<Correspondent> {

    @Getter @Accessors(fluent = true)
    private final DaoRegistry daoRegistry;

    @Getter @Accessors(fluent = true)
    private final Collection<MemberAccessor> memberAccessors = Set.of(
            MemberAccessor.of(Correspondent_.BANK, Wrapper::bank, Wrapper::bank));

    @Override
    public @NonNull Class<Correspondent> domainClass() {
        return Correspondent.class;
    }
}